package org.robustcoupe.task.example;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.robustcoupe.task.AsyncerDecorator;
import org.robustcoupe.task.example.resources.LoggingCurrentTimeTask;
import org.robustcoupe.task.example.resources.TaskEventHandler;
import static org.robustcoupe.task.NestedFunctionStyle.*;

public class AsyncerDecoratorExample {
  static final int RETRY_COUNT = 3;
  static final Log LOG = LogFactory.getLog(AsyncerDecoratorExample.class);

  public static void main(String[] args) throws Exception {
    new LoggingCurrentTimeTask()
      .wrappedByAsycer()
        .event(new TaskEventHandler())
      .execute();
    
    asyncer(
        task(new LoggingCurrentTimeTask()),
        event(new TaskEventHandler())
    ).execute();
    
    AsyncerDecorator.shutdown();
  }
}
